//
//  YJBTradeMarketFrame.m
//  YunJiaBaoFirst
//
//  Created by 腾云小白龍 on 16/7/28.
//  Copyright © 2016年 腾云小白龍. All rights reserved.
//

#import "YJBTradeMarketFrame.h"

@implementation YJBTradeMarketFrame

-(void)setTradeMarketModel:(YJBTradeMarketModel *)tradeMarketModel{
    _tradeMarketModel = tradeMarketModel;
    
    NSString *content = tradeMarketModel.tradeName;
    self.tradeNameLabelF = CGRectMake(5, 5, SCREEN_WIDTH /5 - 5, [content sizeWithFont:[UIFont systemFontOfSize:12] maxW:SCREEN_WIDTH /5 -10].height);
    self.tradeCodeLabelF = CGRectMake(5, CGRectGetMaxY(self.tradeNameLabelF) + 5, SCREEN_WIDTH / 5 -5 , 14);
    
    CGFloat totalH = CGRectGetHeight(self.tradeNameLabelF) + CGRectGetHeight(self.tradeCodeLabelF) + 5 + 5 + 5;
    CGFloat priceH = 14 + 5 + 14;
    
    CGFloat priceY = (totalH - priceH) / 2;
    
    self.presentPriceLabelF = CGRectMake(CGRectGetMaxX(self.tradeNameLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    self.presentCountsLabelF = CGRectMake(CGRectGetMaxX(self.tradeCodeLabelF) + 5, CGRectGetMaxY(self.presentPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    self.buyPriceLabelF = CGRectMake(CGRectGetMaxX(self.presentPriceLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    self.buyCountsLabelF = CGRectMake(CGRectGetMaxX(self.presentCountsLabelF) + 5, CGRectGetMaxY(self.buyPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    self.sellPriceLabelF = CGRectMake(CGRectGetMaxX(self.buyPriceLabelF) + 5, priceY, SCREEN_WIDTH / 5 - 10, 14);
    self.sellCountsLabelF = CGRectMake(CGRectGetMaxX(self.buyCountsLabelF) + 5, CGRectGetMaxY(self.sellPriceLabelF) + 5, SCREEN_WIDTH / 5 - 10, 14);
    
    self.cellHeight = CGRectGetMaxY(self.tradeCodeLabelF) + 5;
    
    self.risePercentLabelF = CGRectMake(CGRectGetMaxX(self.sellPriceLabelF), 0, SCREEN_WIDTH / 5, self.cellHeight);
}

@end
